class Solution {
public:
    vector<int> plusOne(vector<int>& digits) {
        int  a= digits.size();
        for (int i = a - 1; i >= 0; --i) {
            if (digits[i] != 9) {
                ++digits[i];
                for (int j = i + 1; j < a; ++j) {
                    digits[j] = 0;
                }
                return digits;
            }
        }

        vector<int> abc(a + 1);
        abc[0] = 1;
        return abc;
    }
};
